Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove outbox store #523

Merged
merged 2 commits into from
Mar 8, 2024
Merged

remove outbox store #523

merged 2 commits into from
Mar 8, 2024

Conversation

DavidBadura
Copy link
Member

The outbox store is removed because it simply duplicated the event store. Instead, you can use a subscriber that does exactly the same thing:

<?php

namespace App\Share\Infrastructure\EventSourcing;

use Patchlevel\EventSourcing\Attribute\Projector;
use Patchlevel\EventSourcing\Attribute\Subscribe;
use Patchlevel\EventSourcing\EventBus\Message;
use Patchlevel\EventSourcing\Projection\Projection\RunMode;

#[Projector('outbox', runMode: RunMode::FromNow)]
class OutboxProcessor
{
    public function __construct(
        private readonly EventBus $eventBus,
    ) {
    }

    #[Subscribe('*')]
    public function publish(Message $message): void
    {
        $this->eventBus->dispatch($message);
    }
}

@DavidBadura DavidBadura added this to the 3.0.0 milestone Mar 7, 2024
@DavidBadura DavidBadura requested a review from DanielBadura March 7, 2024 11:37
Copy link

github-actions bot commented Mar 7, 2024

Hello 👋

here is the most recent benchmark result:

SnapshotsBench
==============

+----------------------------------------+--------------------+--------------------+-----------------+------------+
|                                        | time (kde mode)                         | memory                       |
+----------------------------------------+--------------------+--------------------+-----------------+------------+
| subject                                | Tag: <current>     | Tag: base          | Tag: <current>  | Tag: base  |
+----------------------------------------+--------------------+--------------------+-----------------+------------+
| benchLoad10000EventsMissingSnapshot () | 168.804ms (±0.00%) | 167.843ms (±0.00%) | 38.613mb        | 38.681mb   |
| benchLoad10000Events ()                | 502.300μs (±0.00%) | 516.800μs (±0.00%) | 38.613mb        | 38.681mb   |
+----------------------------------------+--------------------+--------------------+-----------------+------------+

SimpleSetupBench
================

+----------------------------------------+--------------------+--------------------+-----------------+------------+
|                                        | time (kde mode)                         | memory                       |
+----------------------------------------+--------------------+--------------------+-----------------+------------+
| subject                                | Tag: <current>     | Tag: base          | Tag: <current>  | Tag: base  |
+----------------------------------------+--------------------+--------------------+-----------------+------------+
| benchLoad10000Events ()                | 169.318ms (±0.00%) | 165.986ms (±0.00%) | 38.616mb        | 38.684mb   |
| benchSave1Event ()                     | 1.020ms (±0.00%)   | 907.800μs (±0.00%) | 38.616mb        | 38.684mb   |
| benchSave10000Events ()                | 481.333ms (±0.00%) | 492.143ms (±0.00%) | 38.882mb        | 38.951mb   |
| benchSave10000Aggregates ()            | 9.735s (±0.00%)    | 9.758s (±0.00%)    | 38.616mb        | 38.684mb   |
| benchSave10000AggregatesTransaction () | 7.507s (±0.00%)    | 7.458s (±0.00%)    | 38.616mb        | 38.684mb   |
+----------------------------------------+--------------------+--------------------+-----------------+------------+

SplitStreamBench
================

+-------------------------+--------------------+--------------------+-----------------+------------+
|                         | time (kde mode)                         | memory                       |
+-------------------------+--------------------+--------------------+-----------------+------------+
| subject                 | Tag: <current>     | Tag: base          | Tag: <current>  | Tag: base  |
+-------------------------+--------------------+--------------------+-----------------+------------+
| benchLoad10000Events () | 5.717ms (±0.00%)   | 5.661ms (±0.00%)   | 42.481mb        | 42.549mb   |
| benchSave10000Events () | 632.826ms (±0.00%) | 649.309ms (±0.00%) | 42.758mb        | 42.827mb   |
+-------------------------+--------------------+--------------------+-----------------+------------+

ProjectionistBench
==================

+---------------------------+-----------------+-----------------+-----------------+------------+
|                           | time (kde mode)                   | memory                       |
+---------------------------+-----------------+-----------------+-----------------+------------+
| subject                   | Tag: <current>  | Tag: base       | Tag: <current>  | Tag: base  |
+---------------------------+-----------------+-----------------+-----------------+------------+
| benchHandle10000Events () | 3.332s (±0.00%) | 3.352s (±0.00%) | 39.011mb        | 39.079mb   |
+---------------------------+-----------------+-----------------+-----------------+------------+

This comment gets update everytime a new commit comes in!

Copy link
Member

@DanielBadura DanielBadura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to add more context in the docs? Still referencing outbox and why we dont use it (anymore)?

@DavidBadura
Copy link
Member Author

I'll rewrite this with the projection and pipeline, as soon as the namming etc. is correct.
#481

@DavidBadura DavidBadura merged commit 5c5ec5a into 3.0.x Mar 8, 2024
32 of 33 checks passed
@DavidBadura DavidBadura deleted the remove-outbox branch March 8, 2024 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants